import request from '@/utils/request'
export const getArticles = params => {
  return request({
    method: 'GET',
    url: '/v1_0/articles',
    params,
  })
}

export const getArticleById = id => {
  return request({
    url: '/v1_0/articles/' + id,
    method: 'get',
  })
}

export const addCollect = target => {
  return request({
    url: '/v1_0/article/collections',
    method: 'post',
    data: {
      target,
    },
  })
}

export const delCollect = target => {
  return request({
    url: '/v1_0/article/collections/' + target,
    method: 'DELETE',
  })
}

export const addLike = articleId => {
  return request({
    url: '/v1_0/article/likings',
    method: 'post',
    data: {
      target: articleId,
    },
  })
}

export const delLike = articleId => {
  return request({
    url: '/v1_0/article/likings/' + articleId,
    method: 'DELETE',
  })
}
